/*
 * Academic License - for use in teaching, academic research, and meeting
 * course requirements at degree granting institutions only.  Not for
 * government, commercial, or other organizational use.
 *
 * mean.c
 *
 * Code generation for function 'mean'
 *
 */

/* Include files */
#include "mean.h"
#include "types.h"
#include "rt_nonfinite.h"
#include <string.h>

/* Function Definitions */
void mean(const emxArray_real_T *x, double y[1024])
{
  const double *x_data;
  int k;
  int vlen;
  int xj;
  x_data = x->data;
  vlen = x->size[1];
  if (x->size[1] == 0) {
    memset(&y[0], 0, 1024U * sizeof(double));
  } else {
    for (xj = 0; xj < 1024; xj++) {
      y[xj] = x_data[xj];
    }
    for (k = 2; k <= vlen; k++) {
      int xoffset;
      xoffset = (k - 1) << 10;
      for (xj = 0; xj < 1024; xj++) {
        y[xj] += x_data[xoffset + xj];
      }
    }
  }
  for (vlen = 0; vlen < 1024; vlen++) {
    y[vlen] /= (double)x->size[1];
  }
}

/* End of code generation (mean.c) */
